<?php
/* 
 * Linonline - OpenSource
 *
 *  This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * Note: Every include/require path will be set from root folder (here).
 */
/*
 * TODO Everything... almost.
 */

require_once 'Config.php';
require_once 'classes/DataBase.php';
require_once 'classes/Engine.php';
require_once 'classes/Player.php';

$db = new DataBase($config['db_host'], $config['db_user'], $config['db_pass'], $config['db_base'], $config['db_port']);
$player = new Player();
$engine = new Engine();

session_start();

if(isset($_GET["do"])) {
    // If "do" is parsed, then only that request will be rendered (Ajax)
    $do = explode(":",$_GET["do"]);
    switch ($do[0]) {
        case "register":      include("html/Login.php"); break;
        case "login":         include("html/Login.php"); break;
        case "stats":         include("html/Stats.php"); break;
    }
}else{
    // Else lets render last page, or Intro.
    $engine->render();
}
?>
